package com.phuonghoang.adapter;

import com.phuonghoang.vnexpress.R;
import com.phuonhoang.utils.Variables;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class PaperAdapter extends ArrayAdapter<String> {
	private Context context;
	@SuppressWarnings("unused")
	private String[] papers;

	public PaperAdapter(Context context, int resource, int textViewResourceId,
			String[] papers) {
		super(context, resource, textViewResourceId, papers);
		this.context = context;
		this.papers = papers;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		@SuppressWarnings("static-access")
		LayoutInflater layoutInflater = (LayoutInflater) context
				.getSystemService(context.LAYOUT_INFLATER_SERVICE);
		View rowView = layoutInflater.inflate(R.layout.activity_paper, parent,false);
		
		ImageView image = (ImageView)rowView.findViewById(R.id.ivIcon);
		TextView text = (TextView)rowView.findViewById(R.id.tvPaper);
		image.setImageResource(Variables.ICONS[position]);
		text.setText(Variables.PAPERS[position]);
		return rowView;
	}

}
